﻿// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证（版本 2.0）进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动！任何基于本项目二次开发而产生的一切法律纠纷和责任，我们不承担任何责任！

using SqlSugar;
using System.ComponentModel.DataAnnotations;
namespace Admin.NET.Application.Entity;

/// <summary>
/// 物资信息表
/// </summary>
[Tenant("1300000000001")]
[SugarTable("store_Materials", "物资信息表")]
public partial class StoreMaterials : EntityBaseTenantDel
{
    /// <summary>
    /// 分类Id
    /// </summary>
    [SugarColumn(ColumnName = "StoreTypeId", ColumnDescription = "分类Id")]
    public virtual long? StoreTypeId { get; set; }
    
    /// <summary>
    /// 物资名称
    /// </summary>
    [Required]
    [SugarColumn(ColumnName = "Name", ColumnDescription = "物资名称", Length = 128)]
    public virtual string Name { get; set; }
    
    /// <summary>
    /// 单位
    /// </summary>
    [SugarColumn(ColumnName = "Unit", ColumnDescription = "单位", Length = 32)]
    public virtual string? Unit { get; set; }

    /// <summary>
    /// 单价
    /// </summary>
    [SugarColumn(ColumnName = "Price", ColumnDescription = "单价")]
    public virtual decimal? Price { get; set; }
    
    /// <summary>
    /// 最小库存
    /// </summary>
    [SugarColumn(ColumnName = "MinStock", ColumnDescription = "最小库存")]
    public virtual int? MinStock { get; set; }
    
    /// <summary>
    /// 最大库存
    /// </summary>
    [SugarColumn(ColumnName = "MaxStock", ColumnDescription = "最大库存")]
    public virtual int? MaxStock { get; set; }

    /// <summary>
    /// 排序
    /// </summary>
    [SugarColumn(ColumnName = "OrderNo", ColumnDescription = "排序")]
    public virtual int? OrderNo { get; set; } = 100;

    /// <summary>
    /// 显示状态
    /// </summary>
    [SugarColumn(ColumnDescription = "状态")]
    public StatusEnum Status { get; set; } = StatusEnum.Enable;

    /// <summary>                                                                      
    /// 当前库存数量                                                                  
    /// </summary>                                                                     
    [SugarColumn(ColumnName = "CurrentStock", ColumnDescription = "当前库存数量")]
    public virtual decimal CurrentStock { get; set; } = 0;

    /// <summary>                                                                      
    /// 可用库存（当前库存-预留库存)                                                 
    /// </summary>                                                                     
    [SugarColumn(ColumnName = "AvailableStock", ColumnDescription = "可用库存")]
    public virtual decimal AvailableStock { get; set; } = 0;

    /// <summary>                                                                      
    /// 预留库存
    /// </summary>                                                                     
    [SugarColumn(ColumnName = "ReservedStock", ColumnDescription = "预留库存")]
    public virtual decimal ReservedStock { get; set; } = 0;

    /// <summary>                                                                      
    /// 入库库存（已采购未入库）                                                       
    /// </summary>                                                                     
    [SugarColumn(ColumnName = "InTransitStock", ColumnDescription = "入库库存")]
    public virtual decimal InTransitStock { get; set; } = 0;

    /// <summary>                                                                      
    /// 库存状态（正常、预警、缺货)
    /// </summary>                                                                     
    [SugarColumn(ColumnName = "StockStatus", ColumnDescription = "库存状态")]
    public virtual StockStatusEnum StockStatus { get; set; } = StockStatusEnum.Normal; // 1正常 2预警 3缺货

    /// <summary>
    /// 最后库存更新时间
    /// </summary>
    [SugarColumn(ColumnName = "LastStockUpdateTime", ColumnDescription = "最后库存更新时间")]
    public virtual DateTime? LastStockUpdateTime { get; set; }

    /// <summary>
    /// 备注
    /// </summary>
    [SugarColumn(ColumnName = "Remark", ColumnDescription = "备注", Length = 128)]
    public virtual string? Remark { get; set; }
}